<?php

namespace app\admin\controller;

use think\App;
use think\Controller;
use think\Request;
use app\admin\services\AdminService;
use app\admin\services\InoutService;
use app\admin\services\ProblemService;
use think\facade\Session;

class Inout extends Controller
{
    public function __construct(Request $request = null, App $app = null)
    {
        parent::__construct($request, $app);
        $this->adminService = new AdminService();
        $this->InoutService = new InoutService();
        $this->ProblemService = new ProblemService();
    }

    /**
     * @return mixed
     * 登陆页面
     */
    public function login()
    {
        if (!empty(Session::get('uid','admin'))) {
            $this->redirect('/admin/index/index');
        } else {
//            $this->ProblemService->adseino();
            $this->assign("title", "登陆页面");
            //return $this->fetch();
            return $this->fetch("index");
        }
    }

    /**
     * 后台登陆接口
     */
    public function adminLogin()
    {
        $result = $this->InoutService->adminLogin();
        return $result;
    }

    /**
     * 后台退出
     */
    public function adminOut()
    {
        $result = $this->InoutService->adminOut();
        return $result;
    }

}